package fr.hotel.bo;

import fr.hotel.bo.affinite.Affinite;
import fr.hotel.bo.affinite.Bruit;
import fr.hotel.bo.affinite.Chaleur;
import fr.hotel.bo.affinite.Humidite;
import fr.hotel.bo.affinite.Nourriture;
import fr.hotel.bo.affinite.Odeur;
import fr.hotel.bo.affinite.Voisinnage;

public class Client {
	private int id;
	private Affinite affinite1 = null;
	private Affinite affinite2 = null;
	private Affinite donne = null;

	public Client() {
		super();
	}

	public Affinite getAffinite1() {
		return affinite1;
	}

	public void setAffinite1(Affinite affinite1) {
		this.affinite1 = affinite1;
	}

	public Affinite getAffinite2() {
		return affinite2;
	}

	public void setAffinite2(Affinite affinite2) {
		this.affinite2 = affinite2;
	}

	public Affinite getDonne() {
		return donne;
	}

	public void setDonne(Affinite donne) {
		this.donne = donne;
	}

	private String afficherAffinite(Affinite affinite) {
		String toString = "";
		if (affinite instanceof Bruit)
			toString += affinite.getAffinite()+" Bruit\t";
		else if (affinite instanceof Chaleur)
			toString += affinite.getAffinite()+" Chaleur\t";
		else if (affinite instanceof Humidite)
			toString += affinite.getAffinite()+" Humidite\t";
		else if (affinite instanceof Nourriture)
			toString += affinite.getAffinite()+" Nourriture\t";
		else if (affinite instanceof Odeur)
			toString += affinite.getAffinite()+" Odeur\t";
		else if (affinite instanceof Voisinnage)
			toString += affinite.getAffinite()+" Voisinnage\t";
		return toString;
	}
	
	@Override
	public String toString() {
		String toString = "Client : " + id + "\n";
		toString += afficherAffinite(affinite1);
		toString += afficherAffinite(affinite2);

		toString += "\nDonne = " + donne + "\n";

		return toString;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Client other = (Client) obj;
		if (id != other.id)
			return false;
		return true;
	}

}
